package com.project.service;

import com.project.dao.CourseStudentMapper;
import com.project.entity.CourseStudent;
import com.project.myBeans.StudentInfoDetail;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = {Exception.class})
@Service
public class CourseStudentServiceImpl extends BaseService implements CourseStudentService {

    @Autowired
    CourseStudentMapper courseStudentMapper;

    @Override
    public void add(CourseStudent courseStudent) {
        courseStudentMapper.insert(courseStudent);
    }

    @Override
    public void remove(Integer studentid) {
        courseStudentMapper.deleteByStudentId(studentid);
    }

    @Override
    public List<CourseStudent> findByCourseTeacherid(Integer courseteacherid) {
        return courseStudentMapper.selectByCourseTeacherid(courseteacherid);
    }

    @Override
    public List<CourseStudent> findByStudentid(Integer studentid) {
        return courseStudentMapper.selectByStudentid(studentid);
    }
}
